﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GtsServer.Model;
using GtsServer.DAL;
using System.Data;
using GtsServer.Common;

namespace GtsServer.Manage.Controller
{
    public class PrizeController
    {
        PrizeDAL prizeDal = new PrizeDAL();

        public List<PrizeShow> GetListByIsTaskCondition()
        {
            DataSet ds = prizeDal.GetListByIsTaskCondition();
            return IListDataSet.DataSetToIList<PrizeShow>(ds, 0).ToList();
        }

        public int Add(Prize model)
        {
            return prizeDal.Add(model);
        }

        public bool Update(Prize model)
        {
            return prizeDal.Update(model);
        }

        public bool Delete(int id)
        {
            return prizeDal.Delete(id);
        }

        public List<PrizeShow> GetList(int pageIndex, int pageSize, out int count, int typeID)
        {
            count = 0;
            DataSet ds = prizeDal.GetList(pageIndex, pageSize, typeID);
            count = Convert.ToInt32(ds.Tables[1].Rows[0][0]);
            return IListDataSet.DataSetToIList<PrizeShow>(ds, 0).ToList();
        }
        public List<Prize> GetPrizeName()
        {
            DataSet ds = prizeDal.GetPrizeName();
            return IListDataSet.DataSetToIList<Prize>(ds, 0).ToList();
        }
        public List<Prize> GetPrizeName(int typeID)
        {
            DataSet ds = prizeDal.GetPrizeName(typeID);
            return IListDataSet.DataSetToIList<Prize>(ds, 0).ToList();
        }

        public List<Prize> GetList(string strWhere = "")
        {
            DataSet ds = prizeDal.GetList(strWhere);
            return IListDataSet.DataSetToIList<Prize>(ds, 0).ToList();
        }

        public List<Prize> GetListIDNames(string strWhere = "")
        {
            DataSet ds = prizeDal.GetListIDNames(strWhere);
            return IListDataSet.DataSetToIList<Prize>(ds, 0).ToList();
        }
    }
}
